<!DOCTYPE html>
<html>
	<head>
		<meta charset="utf-8">
		<title>商品详情</title>
			<script type="text/javascript" src="vue.js"></script>
			<script type="text/javascript" src="axios.min.js"></script>
			<script type="text/javascript" src="const.js"></script>
	</head>
	<body>
		<div id="app">
			<img v-bind:src="item.itemImage"/><p></p>
			{{item.itemName}}<p></p>
			{{item.itemPrice}}<p></p>
			{{item.itemDesc}}<p></p>
			商品评论
		</div>
	</body>
	<script type="text/javascript">
		var config={
			el:"#app",
			data:{item:null},
			mounted:function(){
				//网页加载完后自动执行
				//detail.html?itemId=1
				var search=location.search;//?itemId=1
				search=search.substr(1);//itemId=1
				var array=search.split("=");
				var itemId=array[1];
				var serverUrl=serverHost+"/item/findByItemId?itemId="+itemId;
				axios.get(serverUrl)
				.then(function(response){
					var item=response.data;
					this.vue.item=item;
					console.log(item);
				})
				.catch();
			}
		};
		var vue=new Vue(config);
	</script>
</html>
